﻿using System;
using System.Data;
using System.Collections.Generic;
using Chenxin.Lib.Business.Entity;
namespace Chenxin.Lib.Business.BLL
{
    /// <summary>
    /// 业务逻辑类t_Intention_BillGetedInfo 的摘要说明。
    /// </summary>
    public class t_Intention_BillGetedInfo
    {
        public t_Intention_BillGetedInfo()
        { }
        #region  成员方法

        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.Add(model);
        }

        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo model)
        {
            Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.Update(model);
        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public void Delete(Guid BillId)
        {

            Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.Delete(BillId);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo GetModel(Guid BillId)
        {

            return Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.GetModel(BillId);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.GetList(strWhere);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo GetCode(string strWhere)
        {
            return Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.GetCode(strWhere);
        }
        
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo> GetModelList(string strWhere)
        {
            DataSet ds = Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo> DataTableToList(DataTable dt)
        {
            List<Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo> modelList = new List<Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Chenxin.Lib.Business.Entity.t_Intention_BillGetedInfo();
					if(dt.Rows[n]["BillId"].ToString()!="")
					{
						model.BillId=new Guid(dt.Rows[n]["BillId"].ToString());
					}
					model.BillCode=dt.Rows[n]["BillCode"].ToString();
					if(dt.Rows[n]["InOrOut"].ToString()!="")
					{
						model.InOrOut=int.Parse(dt.Rows[n]["InOrOut"].ToString());
					}
					if(dt.Rows[n]["IntentionId"].ToString()!="")
					{
						model.IntentionId=new Guid(dt.Rows[n]["IntentionId"].ToString());
					}
					model.IntentionCode=dt.Rows[n]["IntentionCode"].ToString();
					if(dt.Rows[n]["GetedCityId"].ToString()!="")
					{
						model.GetedCityId=new Guid(dt.Rows[n]["GetedCityId"].ToString());
					}
					model.GetedCity=dt.Rows[n]["GetedCity"].ToString();
					if(dt.Rows[n]["GetedCompanyId"].ToString()!="")
					{
						model.GetedCompanyId=new Guid(dt.Rows[n]["GetedCompanyId"].ToString());
					}
					model.GetedCompany=dt.Rows[n]["GetedCompany"].ToString();
					if(dt.Rows[n]["GetedDepartId"].ToString()!="")
					{
						model.GetedDepartId=new Guid(dt.Rows[n]["GetedDepartId"].ToString());
					}
					model.GetedDepart=dt.Rows[n]["GetedDepart"].ToString();
					if(dt.Rows[n]["GetedEmployeeId"].ToString()!="")
					{
						model.GetedEmployeeId=new Guid(dt.Rows[n]["GetedEmployeeId"].ToString());
					}
					model.GetedEmployee=dt.Rows[n]["GetedEmployee"].ToString();
					if(dt.Rows[n]["AccountType"].ToString()!="")
					{
						model.AccountType=int.Parse(dt.Rows[n]["AccountType"].ToString());
					}
					model.AccountBank=dt.Rows[n]["AccountBank"].ToString();
					model.AccountNum=dt.Rows[n]["AccountNum"].ToString();
					if(dt.Rows[n]["GetedMoney"].ToString()!="")
					{
						model.GetedMoney=decimal.Parse(dt.Rows[n]["GetedMoney"].ToString());
					}
					if(dt.Rows[n]["GetedTime"].ToString()!="")
					{
						model.GetedTime=DateTime.Parse(dt.Rows[n]["GetedTime"].ToString());
					}
					if(dt.Rows[n]["bCustody"].ToString()!="")
					{
						model.bCustody=int.Parse(dt.Rows[n]["bCustody"].ToString());
					}
					if(dt.Rows[n]["PayTo"].ToString()!="")
					{
						model.PayTo=int.Parse(dt.Rows[n]["PayTo"].ToString());
					}
					if(dt.Rows[n]["IsConfirmed"].ToString()!="")
					{
						if((dt.Rows[n]["IsConfirmed"].ToString()=="1")||(dt.Rows[n]["IsConfirmed"].ToString().ToLower()=="true"))
						{
						model.IsConfirmed=true;
						}
						else
						{
							model.IsConfirmed=false;
						}
					}
					if(dt.Rows[n]["ConfirmDate"].ToString()!="")
					{
						model.ConfirmDate=DateTime.Parse(dt.Rows[n]["ConfirmDate"].ToString());
					}
					if(dt.Rows[n]["ConfirmEmployeeId"].ToString()!="")
					{
						model.ConfirmEmployeeId=new Guid(dt.Rows[n]["ConfirmEmployeeId"].ToString());
					}
					model.ConfirmEmployee=dt.Rows[n]["ConfirmEmployee"].ToString();
					if(dt.Rows[n]["IsReview"].ToString()!="")
					{
						if((dt.Rows[n]["IsReview"].ToString()=="1")||(dt.Rows[n]["IsReview"].ToString().ToLower()=="true"))
						{
						model.IsReview=true;
						}
						else
						{
							model.IsReview=false;
						}
					}
					if(dt.Rows[n]["ReviewDate"].ToString()!="")
					{
						model.ReviewDate=DateTime.Parse(dt.Rows[n]["ReviewDate"].ToString());
					}
					if(dt.Rows[n]["ReviewEmployeeId"].ToString()!="")
					{
						model.ReviewEmployeeId=new Guid(dt.Rows[n]["ReviewEmployeeId"].ToString());
					}
					model.ReviewEmployee=dt.Rows[n]["ReviewEmployee"].ToString();
					if(dt.Rows[n]["Addtime"].ToString()!="")
					{
						model.Addtime=DateTime.Parse(dt.Rows[n]["Addtime"].ToString());
					}
					if(dt.Rows[n]["AddEmployeeId"].ToString()!="")
					{
						model.AddEmployeeId=new Guid(dt.Rows[n]["AddEmployeeId"].ToString());
					}
					model.AddEmployee=dt.Rows[n]["AddEmployee"].ToString();
					if(dt.Rows[n]["AddDepartId"].ToString()!="")
					{
						model.AddDepartId=new Guid(dt.Rows[n]["AddDepartId"].ToString());
					}
					model.AddDepart=dt.Rows[n]["AddDepart"].ToString();
					if(dt.Rows[n]["UpdateEmployeeId"].ToString()!="")
					{
						model.UpdateEmployeeId=new Guid(dt.Rows[n]["UpdateEmployeeId"].ToString());
					}
					model.UpdateEmployee=dt.Rows[n]["UpdateEmployee"].ToString();
					if(dt.Rows[n]["UpdateTime"].ToString()!="")
					{
						model.UpdateTime=DateTime.Parse(dt.Rows[n]["UpdateTime"].ToString());
					}
					if(dt.Rows[n]["Status"].ToString()!="")
					{
						model.Status=int.Parse(dt.Rows[n]["Status"].ToString());
					}
					if(dt.Rows[n]["DeleteTime"].ToString()!="")
					{
						model.DeleteTime=DateTime.Parse(dt.Rows[n]["DeleteTime"].ToString());
					}
					if(dt.Rows[n]["DeleteEmpId"].ToString()!="")
					{
						model.DeleteEmpId=new Guid(dt.Rows[n]["DeleteEmpId"].ToString());
					}
					model.DeleteEmp=dt.Rows[n]["DeleteEmp"].ToString();
					model.DeleteReason=dt.Rows[n]["DeleteReason"].ToString();
					if(dt.Rows[n]["TotalPrintCount"].ToString()!="")
					{
						model.TotalPrintCount=int.Parse(dt.Rows[n]["TotalPrintCount"].ToString());
					}
					if(dt.Rows[n]["LastPrintTime"].ToString()!="")
					{
						model.LastPrintTime=DateTime.Parse(dt.Rows[n]["LastPrintTime"].ToString());
					}
					if(dt.Rows[n]["LastPrintEmpId"].ToString()!="")
					{
						model.LastPrintEmpId=new Guid(dt.Rows[n]["LastPrintEmpId"].ToString());
					}
					model.LastPrintEmp=dt.Rows[n]["LastPrintEmp"].ToString();
					modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return Chenxin.Lib.Business.DAL.t_Intention_BillGetedInfo.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

